using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using Common;
using Common.Enum;
using SSettings;

namespace SettingsView
{
	public partial class UCSettingsMain : UserControl, IComponentConnector
	{
		public UCSettingsMain()
		{
			InitializeComponent();
			rbSearch.IsEnabled = true;
		}

		private void Grid_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
		{
			ConfigSettings configSettings = base.DataContext as ConfigSettings;
			if (configSettings != null)
			{
				ComboBoxProjectType.SelectedIndex = 0;
			}
		}

		private void ComboBoxProjectType_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			ConfigSettings configSettings = base.DataContext as ConfigSettings;
			if (configSettings != null && ComboBoxProjectType.SelectedItem != null)
			{
				EProjectType type = (EProjectType)((KeyValuePair)ComboBoxProjectType.SelectedItem).Key;
				ucGridColumnEdit.GridColumns = configSettings.GetGirdColumnsCommon(type);
			}
		}

		public bool IsExperimentSettingTabSelected()
		{
			TabItem tabItem = settingTab.SelectedItem as TabItem;
			if (tabItem.Header.Equals(Utility.GetMessage("experiment_setting")))
			{
				return rbSetting.IsChecked == true;
			}
			return false;
		}

		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
		[DebuggerNonUserCode]
		internal Delegate _CreateDelegate(Type delegateType, string handler)
		{
			return Delegate.CreateDelegate(delegateType, this, handler);
		}
	}
}
